package com.solution.util;
import javax.mail.PasswordAuthentication;

import org.apache.log4j.Logger;

class GJMailAuthenticator extends javax.mail.Authenticator{ 
	
	private static String strMailFrom;
	private static String fromPassword;
	private static final Logger log = Logger.getLogger(GJMailAuthenticator.class);
	static{
		try{
			strMailFrom = Repository.getRepository().getSystemProperty("mailFrom");
			fromPassword = Repository.getRepository().getSystemProperty("passwordFrom");
		}
		catch (Exception e) {
			log.error("Mail sender construction error", e);
			throw new RuntimeException(e);
		}
	}
	protected PasswordAuthentication getPasswordAuthentication(){  
		return new PasswordAuthentication(strMailFrom,fromPassword);  
	}  
} 